# $Id$
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: tobias <tobias funnychar archlinux.org>

pkgname=xfce4-session
pkgver=4.12.1
pkgrel=8
pkgdesc="A session manager for Xfce"
arch=('x86_64')
url="http://www.xfce.org/"
license=('GPL2')
groups=('xfce4')
depends=('libxfce4ui' 'libwnck' 'libsm' 'polkit' 'xorg-iceauth' 'xorg-xinit'
         'xorg-xrdb' 'which' 'polkit-gnome' 'hicolor-icon-theme')
makedepends=('intltool')
optdepends=('gnome-keyring: for keyring support when GNOME compatibility is enabled'
            'xscreensaver: for locking screen with xflock4'
            'gnome-screensaver: for locking screen with xflock4'
            'xlockmore: for locking screen with xflock4'
            'slock: for locking screen with xflock4')
replaces=('xfce-utils')
source=(https://archive.xfce.org/src/xfce/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.bz2
        0001-Pass-VT-number-to-xinit-if-XDG_VTNR-is-set.patch
        0001-Make-verbose-logging-conditional-Bug-11698.patch
        xfce4-session-source-system-xinitrc-scripts.patch
        xfce-polkit-gnome-authentication-agent-1.desktop)
sha256sums=('97d7f2a2d0af7f3623b68d1f04091e02913b28f9555dab8b0d26c8a1299d08fd'
            '7ea702a1d3391d36958cff57496ba2474592dd915cf7569a65501522c2410cf1'
            '6bbd714008f31198f9631cdfb3ed8aac1c780f00d15b81c32c00860ae37521a6'
            'a717a0ee6289c9ce06a8e18c6a7cb5a6d6f1769c05c456a6a84843df6a0111da'
            '74c94c5f7893d714e04ec7d8b8520c978a5748757a0cdcf5128492f09f31b643')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"

  # https://bugzilla.xfce.org/show_bug.cgi?id=11759
  patch -Np1 -i ../0001-Pass-VT-number-to-xinit-if-XDG_VTNR-is-set.patch

  # https://bugzilla.xfce.org/show_bug.cgi?id=11698
  patch -Np1 -i ../0001-Make-verbose-logging-conditional-Bug-11698.patch

  # https://bugzilla.xfce.org/show_bug.cgi?id=12754
  patch -Np1 -i ../xfce4-session-source-system-xinitrc-scripts.patch
}

build() {
  cd "$srcdir/$pkgname-$pkgver"

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --libexecdir=/usr/lib/xfce4 \
    --localstatedir=/var \
    --disable-static \
    --disable-debug
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install

  # Provide a default PolicyKit Authentication Agent (FS#42569)
  install -d "$pkgdir/etc/xdg/autostart"
  cp "$srcdir/xfce-polkit-gnome-authentication-agent-1.desktop" \
    "$pkgdir/etc/xdg/autostart/"
}

# vim:set ts=2 sw=2 et:
